from lxml import etree
from selenium import webdriver
from time import sleep
"""
22空信 邹滨峻
交叉汇率

"""
def getData():
# 获取到edge浏览对象
    edge = webdriver.Edge()
# 获取数据页面的数据
    url = "https://quote.eastmoney.com/center/gridlist.html#forex_cross"
# edge浏览器解析地址
    edge.get(url)
    sleep(20)
# 获取页面中的资源
    page = edge.page_source
# 将页面资源解析成html文件
    html = etree.HTML(page)
    name1 = html.xpath("//tr/td[@class='mywidth']/a/text()")
    name2 = html.xpath("//tr/td[@class='mywidth']/a/span/@title")
    data_4 = html.xpath("//tr/td[4]/span/text()")
    data_5 = html.xpath("//tr/td[5]/span/text()")
    data_6 = html.xpath("//tr/td[6]/span/text()")
    data_7 = html.xpath("//tr/td[7]/span/text()")
    data_8 = html.xpath("//tr/td[8]/span/text()")
    data_9 = html.xpath("//tr/td[9]/span/text()")
    data_10 = html.xpath("//tr/td[10]/text()")

    print(name1)
    print(name2)
    print(data_4)
    print(data_5)
    print(data_6)
    print(data_7)
    print(data_8)
    print(data_9)
    print(data_10)


if __name__ == '__main__':
    getData()
